package com.example.factory.model.api;

import java.util.Date;

/**
 * @author:0.2℃
 * @date： 2022-01-01 18:17
 * @version:
 * @Description ：
 */
@SuppressWarnings({"WeakerAccess", "unused"})
public class RspModel<T> {
        public static final int SUCCEED = 1;

        public static final int ERROR_UNKNOWN = 0;

        public static final int ERROR_NOT_FOUND_USER = 4041;
        public static final int ERROR_NOT_FOUND_GROUP = 4042;
        public static final int ERROR_NOT_FOUND_GROUP_MEMBER = 4043;

        public static final int ERROR_CREATE_USER = 3001;
        public static final int ERROR_CREATE_GROUP = 3002;
        public static final int ERROR_CREATE_MESSAGE = 3003;

        public static final int ERROR_PARAMETERS = 4001;
        public static final int ERROR_PARAMETERS_EXIST_ACCOUNT = 4002;
        public static final int ERROR_PARAMETERS_EXIST_NAME = 4003;

        public static final int ERROR_SERVICE = 5001;

        public static final int ERROR_ACCOUNT_TOKEN = 2001;
        public static final int ERROR_ACCOUNT_LOGIN = 2002;
        public static final int ERROR_ACCOUNT_REGISTER = 2003;

        public static final int ERROR_ACCOUNT_NO_PERMISSION = 2010;

        private int code;
        private String message;
        private Date time;
        private T result;

        public boolean success() {
            return code == SUCCEED;
        }

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public Date getTime() {
            return time;
        }

        public void setTime(Date time) {
            this.time = time;
        }

        public String getMessage() {
            return message;
        }

        public void setMessage(String message) {
            this.message = message;
        }

        public T getResult() {
            return result;
        }

        public void setResult(T result) {
            this.result = result;
        }
}
